package com.adnaan.backend.service.impl;

import com.adnaan.backend.entity.Banner;
import com.adnaan.backend.entity.dto.BannerDto;
import com.adnaan.backend.mapper.BannerMapper;
import com.adnaan.backend.service.BannerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * author: adnaan
 * create: 2025-02-19 13:09
 * Description:
 */
@Service
public class BannerServiceImpl extends ServiceImpl<BannerMapper, Banner> implements BannerService {
    @Override
    public List<BannerDto> getBanners() {
        List<Banner> banners = list();
        return banners.stream().map(banner -> {
            BannerDto bannerDto = new BannerDto();
            bannerDto.setId(banner.getId());
            bannerDto.setImage(banner.getImage());
            bannerDto.setTitle(banner.getTitle());
            bannerDto.setLink(banner.getLink());
            return bannerDto;
        }).toList();
    }
}
